home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
C/C++ Users Group Library 1996 July
/
C-C++ Users Group Library July 1996.iso
/
listings
/
v_09_03
/
9n03127b
< prev
next >
Wrap
Text File
|
1991-01-14
|
455b
|
25 lines
/* given signal index or name as string, */
/* returns signal index or -1 if bad arg */
string_to_signal(s)
char *s;
{
int sig;
char *name;
/* try interpreting as an integer */
if (1 == sscanf(s,"%d",&sig)) return(sig);
/* try interpreting as a string */
for (sig=0;sig<NSIG;sig++) {
name = signals[sig].name;
if (SIG_RESERVED(sig)) name++;
if (streq(s,name) || streq(s,name+3))
return(sig);
}
return(-1);
}